package org.springframework.starter.codemine.config;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.starter.codemine.CodeMine;
import org.springframework.context.annotation.Bean;
import org.springframework.starter.codemine.properties.CodeMineProperties;

@AutoConfigureAfter({CodeMineProperties.class})
@EnableConfigurationProperties({CodeMineProperties.class})
@Configuration
@ConditionalOnMissingBean(CodeMine.class)
@PropertySource(name = "default properties",value = "classpath:/META-INF/codemine-default.properties")
public class CodeMineAutoConfig {

    @Bean
    public CodeMine codeMineConfig(CodeMineProperties properties) {

        return new CodeMine(properties);
    }
}
